package com.lhkj.ct.base.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
  * <p>
  *     描述：文件服务器配置
  * </p>
  */
@Component
@ConfigurationProperties(prefix = "system.file")
public class FileServerConfig {

    /**
     * 上传路径
     */
    private static String profile;

    /**
     * 资源映射路径 前缀
     */
    private static String resourcePrefix;

    /**
     * 如 D:/uploadPath 或/usr/local
     * @return
     */
    public static String getProfile() {
        return profile;
    }

    public void setProfile(String profile) {
        FileServerConfig.profile = profile;
    }

    public static String getResourcePrefix() {
        return resourcePrefix;
    }

    public void setResourcePrefix(String resourcePrefix) {
        FileServerConfig.resourcePrefix = resourcePrefix;
    }

    /**
     * 获取导入上传路径
     */
    public static String getImportPath() {
        return getProfile() + "/import";
    }

    /**
     * 获取头像上传路径
     */
    public static String getAvatarPath() {return getProfile() + "/avatar"; }

    /**
     * 获取下载路径
     */
    public static String getDownloadPath() {
        return getProfile() + "/download/";
    }

    /**
     * 获取上传路径
     */
    public static String getUploadPath() {
        return getProfile() + "/upload";
    }
}
